class Solution {
public:
    int titleToNumber(string s) {
        unsigned long len = s.length();
        int n=0;
        for(int i = 0;i < len;++i) {
            n = n * 26 + (s[i] - 'A' + 1);
        }
        return n;
    }
};